package com.rd.student.jiaji.class1.jinhongyu.day0801;

import java.util.Arrays;

public class PaiXu {
    public static void main(String[] args) {
        int[] arr = {11, 22, 33, 60, 55, 77, 80};
        int n = arr.length;
        boolean b = true;
        for (int i = 0; i < n - 1; i++) {
            for (int j = 0; j < n - i - 1; j++) {
                if (arr[j] > arr[j + 1]) {
                    int temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                    b = false;
                }
                System.out.println(Arrays.toString(arr));
            }
            if (b) { break; }
        }
        System.out.println(Arrays.toString(arr));
    }


    public static void xuanzesort(int[] arr) {

        for (int i = 0; i < arr.length - 1; i++) {
            int index = i;
            for (int j = i + 1; j < arr.length; j++) {
                if (arr[index] > arr[j]) {
                    index = j;
                }
            }
            int temp = arr[i];
            arr[i] = arr[index];
            arr[index] = temp;
        }
    }


}



